package cn.iocoder.yudao.module.member.convert.user;

import cn.iocoder.yudao.module.jifenyuan.api.wallet.dto.WalletRespDto;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoRespVO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface UserConvert {

    UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);

    AppUserInfoRespVO convert(MemberUserDO bean);

    @Mapping(source = "bean.nickname", target = "nickname")
    @Mapping(source = "bean.avatar", target = "avatar")
    @Mapping(source = "bean.mobile", target = "mobile")
    @Mapping(source = "walletRespDto.vip", target = "vip")
    @Mapping(source = "walletRespDto.vipExpireTime", target = "vipExpireTime")
    @Mapping(source = "walletRespDto.coin", target = "coin")
    AppUserInfoRespVO convert(MemberUserDO bean, WalletRespDto walletRespDto);

    MemberUserRespDTO convert2(MemberUserDO bean);

    List<MemberUserRespDTO> convertList2(List<MemberUserDO> list);

}
